from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

<<<<<<< HEAD
=======

>>>>>>> dev
#调用驱动，打开Chrome浏览器
driver = webdriver.Chrome()
#打开蓝墨云登录页面
driver.get('https://www.mosoteach.cn/web/index.php?c=passport&m=index')
sleep(2)
#输入用户名
driver.find_element(By.XPATH, "//*[@id='account-name']").send_keys('18780266036')
sleep(2)
#输入密码
driver.find_element(By.XPATH, "//*[@id='user-pwd']").send_keys('py324832')
sleep(2)
#点击登录按钮
driver.find_element(By.XPATH, "//*[@id='login-button-1']").click()
sleep(2)
current = driver.current_window_handle
all_handles = driver.window_handles
print(current)
sleep(2)
driver.switch_to.window(all_handles[-1])
print(driver.current_window_handle)
print(driver.title)